package com.demo.project_template.exception;

import lombok.Getter;

/**
 * @author ZhangKeChen
 * @date 2022/8/11
 */
@Getter
public class ErrorCodeException extends RuntimeException {

    private final Integer code;
    private final String msg;

    public ErrorCodeException(String msg) {
        this.msg = msg;
        this.code = 500;
    }

    public ErrorCodeException(Integer code, String msg) {
        this.msg = msg;
        this.code = code;
    }

    public ErrorCodeException(ErrorCodeExceptionEnum errorCodeExceptionenum) {
        this(errorCodeExceptionenum.getCode(), errorCodeExceptionenum.getMsg());
    }

}
